package string;

public class MatchesDemo02 {
    public static void main(String[] args) {
        String date = "2021 07 30";
        System.out.println("\\d"); //  \\表示一个\,因为要用\d

        boolean b = date.matches("\\d\\d\\d\\d\\s\\d\\d\\s\\d\\d");
        System.out.println(b);

        b = date.matches("\\d{4}\\s\\d{2}\\s\\d{2}");
        System.out.println(b);

    }
}
